// IMPORTANT: 请务必在局部作用域定义单页面的逻辑
$gs.initView('index', /*init*/function (events) {

    events.showmenu = function () {
        $('#UserList').css('visibility', "visible");
        event.stopPropagation();
    }

    events.change = function () { // 修改
        $gs.easyHtml('#mainWorkspace','/systemUsers/change');
    }

    events.hidmenu = function () {
        $('#UserList').css('visibility', "hidden");
    }

    document.onclick = events.hidmenu;

    var navIndexs = {
    		'平台': '/platform/index',
            '运营': '/menu/operateMenu',
            '电销': '/callcenter/index',
            '地推': '/landPush/index',
            '风控': '/riskControl/index',
            '产品': '/product/index',
            '结算': '/settlement/index',
            '活动': '/activity/manager',
            '系统': 'systemUsers/manager',
            '其他': '/example' ,
    };

    events.navTo = function () {
        var th = $(this),
            activeClz = 'active';
        var navName = th.text().trim();
        if (th.hasClass(activeClz)) {
            console.info(navName + ' already opened');
            return;
        } else {
            console.info('open ' + navName);
        }

        th.parent().children().removeClass(activeClz);
        th.toggleClass(activeClz);

        navIndexs[navName] && ($gs.easyHtml('#mainWorkspace', navIndexs[navName]));
    }
}, /*postInit*/function () {
    //$('#Navi .default').click();
    if($('#Navi li').length>0) $('#Navi li')[$('#Navi li').length-1].click();
})